CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bridge_viewing  main.go

project_name=bridge_viewing
project_env=3d_server
project_host=47.101.189.80

echo 'send server'
scp *.yml *.sh root@$project_host:/opt/deploy/$project_env
scp $project_name root@$project_host:/opt/deploy/$project_env/tmp_$project_name

echo 'backup server exe'
ssh root@$project_host "mv -f /opt/deploy/$project_env/$project_name /opt/deploy/$project_env/$project_name-bak"
ssh root@$project_host "mv -f /opt/deploy/$project_env/tmp_$project_name /opt/deploy/$project_env/$project_name"

echo 'start server'
ssh root@$project_host "export APP_ENV=prod && /opt/deploy/$project_env/start.sh >> /opt/deploy/$project_env/nohup.log"
